package com.example.focusanimator;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.GridView;

public class MainActivity extends AppCompatActivity implements View.OnClickListener, View.OnFocusChangeListener {

    private FlyBorder mBorder;
    private GridView mGridView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mBorder = (FlyBorder) findViewById(R.id.flyborder);
        mGridView = (GridView) findViewById(R.id.gridview);



        initView();
    }

    private void initView() {
        for (int i = 0;i<mGridView.getChildCount();i++){
            mGridView.getChildAt(i).setOnFocusChangeListener(this);
            mGridView.getChildAt(i).setOnClickListener(this);
        }

    }

    @Override
    public void onClick(View v) {

    }

    @Override
    public void onFocusChange(View v, boolean hasFocus) {
        if (hasFocus){
            mBorder.setVisibility(View.VISIBLE);
            mBorder.setTvScreen(true);

        }
    }
}
